package com.ksd.pug.cloud.controller;

import com.ksd.pug.cloud.pojo.SysUser;
import com.ksd.pug.cloud.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 这两个注解的合成 ： Controller + ResponseBody
 */
@RestController
@Slf4j
public class UserController {

    @Autowired
    private IUserService userService;
    @Value("${server.port}")
    private String port;


    @GetMapping("/user2/{id}")
    public SysUser findById(@PathVariable Long id) {
        System.out.println("执行查询了。。。。。。。。");
        SysUser sysUser = userService.getById(id);
        sysUser.setOpenid("我的port是:" + port);
        return sysUser;
    }

}
